using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
    
public class InputAndSliderDemo : MonoBehaviour
{
    private string _inputString = ""; // 必须被赋值
    public Rect rect = new(0, 0, 100, 50);
    public byte maxLength = 5;
    
    private string _pwd = ""; // 必须被赋值
    public Rect pwdRect = new(0, 50, 100, 50);

    private float _voiceLevel = 0f;
    public  Rect voiceRect = new(0, 100, 100, 50);
    
    private void OnGUI()
    {
        #region 输入

        // 普通输入
        _inputString = GUI.TextField(rect, _inputString, maxLength);
        
        // 密码输入框
        _pwd = GUI.PasswordField(pwdRect, _pwd, '☆');

        #endregion

        #region 拖动条

        // 水平拖动条
        // _voiceLevel = GUI.HorizontalSlider(voiceRect, _voiceLevel, 100f, 0f);
        // 竖直拖动条
        _voiceLevel = GUI.HorizontalSlider(voiceRect, _voiceLevel, 0f, 100f);
        print(_voiceLevel);

        #endregion

    }
}